import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { HttpProvider } from '../../providers/http/http';
import { StorageProvider } from '../../providers/storage/storage';
import { DialogProvider } from '../../providers/dialog/dialog';
import { EventProvider } from '../../providers/event/event';
/**
 * Generated class for the Assistant page.
 *
 * See http://ionicframework.com/docs/components/#navigation for more info
 * on Ionic pages and navigation.
 */
@IonicPage()
@Component({
	selector: 'page-assistant',
	templateUrl: 'assistant.html',
})
export class AssistantPage {
	//必须静态常量来传递
	private static thatPage: any;
	constructor(
		public navCtrl: NavController,
		public navParams: NavParams,
		public http: HttpProvider,
		public storage: StorageProvider,
		public dialog: DialogProvider,
		public event: EventProvider) { }

	ionViewDidLoad() {
		console.log('ionViewDidLoad Assistant');
		AssistantPage.thatPage = this;
		//绑定事件
		this.event.bindEvents(this.event.EVENT_CENTER, this.eventPage);
	}
	/*界面销毁*/
	ionViewWillUnload() {
		this.event.unbindEvents(this.event.EVENT_CENTER, this.eventPage);
	}
	/*侦听事件 */
	eventPage(val: any) {
		//替换的字符串
		let replaceStr = AssistantPage.thatPage.http.APP_HTTP_URL + "/ibcms/oa/assetsQrView?id=";
		val = val.replace('\/', '/');
		let id = val.replace(replaceStr, "");
		AssistantPage.thatPage.navCtrl.push("AssistantfixeddetailPage", {
			id: id
		});
	}
	/*待办事务*/
	openassistantlist(type) {
		this.navCtrl.push("AssistantlistPage", {
			type: type
		});
	}
	/*收文传阅*/
	openassistantfiles(type) {
		this.navCtrl.push("ReadofficePage", {
			type: type
		});
	}
	/*内部签报*/
	openassistantinside(type) {
		this.navCtrl.push("ReadinsidePage", {
			type: type
		});
	}
	/*通知公告*/
	openassistantnotice(type) {
		this.navCtrl.push("ReadnoticePage", {
			type: type
		});
	}
	/*资产管理*/
	openassistantassets(type) {
		this.navCtrl.push("AssistantfixedlistPage", {
			type: type
		});
	}
	/*办公用品*/
	openassistantoffice(type) {
		this.navCtrl.push("AssistantofficePage", {
			type: type
		});
	}


	/**
* 固定资产领用申请
*/
	openassistantfixedapply() {
		this.navCtrl.push("AssistantfixedapplyPage");
	}

	/**
* 固定资产归还申请
*/
	openassistantfixedreturn() {
		this.navCtrl.push("AssistantfixedreturnPage");
	}

	/**
* 固定资产报废申请
*/
	openassistantfixedscrap() {
		this.navCtrl.push("AssistantfixedscrapPage");
	}
	/**
 * 办公用品申请
 */
	openassistantofficeapply() {
		this.navCtrl.push("AssistantofficeapplyPage");
	}
	/**
 * 办公用品归还
 */
	openassistantofficereturn() {
		this.navCtrl.push("AssistantofficereturnPage");
	}

	/**
 * 扫码处理
 */
	doscan() {
		this.navCtrl.push("ModalqrscanPage");
	}
	/**
	 * 请假申请
	 */
	openassistantqingjia() {
		this.navCtrl.push("AssistantqingjiaPage");
	}
	/**
 * 出差申请
 */
	openassistantchuchai() {
		this.navCtrl.push("AssistantchuchaiPage");
	}
	/**
 * 车辆申请
 */
	openassistantcheliang() {
		this.navCtrl.push("AssistantcheliangPage");
	}

	/**
* 项目立项申请
*/
	openassistantlixiang() {
		this.navCtrl.push("AssistantlixiangPage");
	}

	/**
* 项目采购申请
*/
	openassistantcaigou() {
		this.navCtrl.push("AssistantcaigouPage");
	}
}